It is deprecated in favor of the regular GLib functions.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/718
/* exported getIBusManager */
const { Gio, GLib, IBus } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const IBusCandidatePopup = imports.ui.ibusCandidatePopup;
return;
if (this._preloadEnginesId != 0) {
- Mainloop.source_remove(this._preloadEnginesId);
+ GLib.source_remove(this._preloadEnginesId);
this._preloadEnginesId = 0;
}
this._preloadEnginesId =
- Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME,
- () => {
- this._ibus.preload_engines_async(
- ids,
- -1,
- null,
- null);
- this._preloadEnginesId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ GLib.timeout_add_seconds(
+ GLib.PRIORITY_DEFAULT,
+ this._PRELOAD_ENGINES_DELAY_TIME,
+ () => {
+ this._ibus.preload_engines_async(
+ ids,
+ -1,
+ null,
+ null);
+ this._preloadEnginesId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
}
};
Signals.addSignalMethods(IBusManager.prototype);
WindowCyclerPopup */
const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
const SwitcherPopup = imports.ui.switcherPopup;
if (this._thumbnails)
this._destroyThumbnails();
if (this._thumbnailTimeoutId != 0)
- Mainloop.source_remove(this._thumbnailTimeoutId);
+ GLib.source_remove(this._thumbnailTimeoutId);
}
/**
}
if (this._thumbnailTimeoutId != 0) {
- Mainloop.source_remove(this._thumbnailTimeoutId);
+ GLib.source_remove(this._thumbnailTimeoutId);
this._thumbnailTimeoutId = 0;
}
this._thumbnails.highlight(window, forceAppFocus);
} else if (this._items[this._selectedIndex].cachedWindows.length > 1 &&
!forceAppFocus) {
- this._thumbnailTimeoutId = Mainloop.timeout_add (
+ this._thumbnailTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
THUMBNAIL_POPUP_TIME,
this._timeoutPopupThumbnails.bind(this));
GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell] this._timeoutPopupThumbnails');
_onDestroy() {
if (this._mouseTimeOutId != 0)
- Mainloop.source_remove(this._mouseTimeOutId);
+ GLib.source_remove(this._mouseTimeOutId);
this.icons.forEach(icon => {
icon.app.disconnect(icon._stateChangedId);
// activation when the thumbnail list is open
_onItemEnter(index) {
if (this._mouseTimeOutId != 0)
- Mainloop.source_remove(this._mouseTimeOutId);
+ GLib.source_remove(this._mouseTimeOutId);
if (this._altTabPopup.thumbnailsVisible) {
- this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT,
- () => {
- this._enterItem(index);
- this._mouseTimeOutId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ this._mouseTimeOutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ APP_ICON_HOVER_TIMEOUT,
+ () => {
+ this._enterItem(index);
+ this._mouseTimeOutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else {
this._itemEntered(index);
/* exported Animation, AnimatedIcon, Spinner */
const { Clutter, GLib, Gio, St } = imports.gi;
-const Mainloop = imports.mainloop;
var ANIMATED_ICON_UPDATE_TIMEOUT = 16;
var SPINNER_ANIMATION_TIME = 300;
stop() {
if (this._timeoutId > 0) {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
-const Mainloop = imports.mainloop;
const AppFavorites = imports.ui.appFavorites;
const BoxPointer = imports.ui.boxpointer;
_removeMenuTimeout() {
if (this._popupTimeoutId > 0) {
- Mainloop.source_remove(this._popupTimeoutId);
+ GLib.source_remove(this._popupTimeoutId);
this._popupTimeoutId = 0;
}
}
_setPopupTimeout() {
this._removeMenuTimeout();
- this._popupTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
+ this._popupTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MENU_POPUP_TIMEOUT, () => {
this._popupTimeoutId = 0;
this._popupRenamePopup();
return GLib.SOURCE_REMOVE;
_removeMenuTimeout() {
if (this._menuTimeoutId > 0) {
- Mainloop.source_remove(this._menuTimeoutId);
+ GLib.source_remove(this._menuTimeoutId);
this._menuTimeoutId = 0;
}
}
_setPopupTimeout() {
this._removeMenuTimeout();
- this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
+ this._menuTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MENU_POPUP_TIMEOUT, () => {
this._menuTimeoutId = 0;
this.popupMenu();
return GLib.SOURCE_REMOVE;
/* exported Component */
const { Gio, GLib } = imports.gi;
-const Mainloop = imports.mainloop;
const Params = imports.misc.params;
const GnomeSession = imports.misc.gnomeSession;
this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', this._onDriveDisconnected.bind(this));
this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', this._onDriveEjectButton.bind(this));
- this._mountAllId = Mainloop.idle_add(this._startupMountAll.bind(this));
+ this._mountAllId = GLib.idle_add(GLib.PRIORITY_DEFAULT, this._startupMountAll.bind(this));
GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
}
this._volumeMonitor.disconnect(this._driveEjectButtonId);
if (this._mountAllId > 0) {
- Mainloop.source_remove(this._mountAllId);
+ GLib.source_remove(this._mountAllId);
this._mountAllId = 0;
}
}
_onVolumeRemoved(monitor, volume) {
if (volume._allowAutorunExpireId && volume._allowAutorunExpireId > 0) {
- Mainloop.source_remove(volume._allowAutorunExpireId);
+ GLib.source_remove(volume._allowAutorunExpireId);
delete volume._allowAutorunExpireId;
}
this._volumeQueue =
}
_allowAutorunExpire(volume) {
- let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
+ let id = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
volume.allowAutorun = false;
delete volume._allowAutorunExpireId;
return GLib.SOURCE_REMOVE;
const { Clutter, Gio, GLib, GObject, St } = imports.gi;
const Lang = imports.lang;
-const Mainloop = imports.mainloop;
var Tpl = null;
var Tp = null;
// Wait a bit before notifying for the received message, a handler
// could ack it in the meantime.
if (this._notifyTimeoutId != 0)
- Mainloop.source_remove(this._notifyTimeoutId);
- this._notifyTimeoutId = Mainloop.timeout_add(500,
+ GLib.source_remove(this._notifyTimeoutId);
+ this._notifyTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500,
this._notifyTimeout.bind(this));
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
}
destroy(reason) {
if (this._timestampTimeoutId)
- Mainloop.source_remove(this._timestampTimeoutId);
+ GLib.source_remove(this._timestampTimeoutId);
this._timestampTimeoutId = 0;
super.destroy(reason);
}
// Reset the old message timeout
if (this._timestampTimeoutId)
- Mainloop.source_remove(this._timestampTimeoutId);
+ GLib.source_remove(this._timestampTimeoutId);
this._timestampTimeoutId = 0;
let message = { realMessage: props.group != 'meta',
} else {
// Schedule a new timestamp in SCROLLBACK_IMMEDIATE_TIME
// from the timestamp of the message.
- this._timestampTimeoutId = Mainloop.timeout_add_seconds(
+ this._timestampTimeoutId = GLib.timeout_add_seconds(
+ GLib.PRIORITY_DEFAULT,
SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp),
this.appendTimestamp.bind(this));
GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp');
// Remove composing timeout.
if (this._composingTimeoutId > 0) {
- Mainloop.source_remove(this._composingTimeoutId);
+ GLib.source_remove(this._composingTimeoutId);
this._composingTimeoutId = 0;
}
if (text != '') {
this.notification.source.setChatState(Tp.ChannelChatState.COMPOSING);
- this._composingTimeoutId = Mainloop.timeout_add_seconds(
+ this._composingTimeoutId = GLib.timeout_add_seconds(
+ GLib.PRIORITY_DEFAULT,
COMPOSING_STOP_TIMEOUT,
this._composingStopTimeout.bind(this));
GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout');
/* exported Dash */
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const AppDisplay = imports.ui.appDisplay;
// that the notify::hover handler does everything we need to.
if (opened) {
if (this._showLabelTimeoutId > 0) {
- Mainloop.source_remove(this._showLabelTimeoutId);
+ GLib.source_remove(this._showLabelTimeoutId);
this._showLabelTimeoutId = 0;
}
if (shouldShow) {
if (this._showLabelTimeoutId == 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
- this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
+ this._showLabelTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
() => {
this._labelShowing = true;
item.showLabel();
});
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
if (this._resetHoverTimeoutId > 0) {
- Mainloop.source_remove(this._resetHoverTimeoutId);
+ GLib.source_remove(this._resetHoverTimeoutId);
this._resetHoverTimeoutId = 0;
}
}
} else {
if (this._showLabelTimeoutId > 0)
- Mainloop.source_remove(this._showLabelTimeoutId);
+ GLib.source_remove(this._showLabelTimeoutId);
this._showLabelTimeoutId = 0;
item.hideLabel();
if (this._labelShowing) {
- this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
+ this._resetHoverTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DASH_ITEM_HOVER_TIMEOUT,
() => {
this._labelShowing = false;
this._resetHoverTimeoutId = 0;
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-const Mainloop = imports.mainloop;
-
const { AccountsService, Clutter, Gio,
GLib, GObject, Pango, Polkit, Shell, St } = imports.gi;
let startTime = GLib.get_monotonic_time();
this._secondsLeft = this._totalSecondsToStayOpen;
- this._timerId = Mainloop.timeout_add_seconds(1, () => {
+ this._timerId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
let currentTime = GLib.get_monotonic_time();
let secondsElapsed = ((currentTime - startTime) / 1000000);
_stopTimer() {
if (this._timerId > 0) {
- Mainloop.source_remove(this._timerId);
+ GLib.source_remove(this._timerId);
this._timerId = 0;
}
const { Clutter, Cogl, Gio, GLib,
GObject, Meta, Pango, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const System = imports.system;
/* Imports...feel free to add here as needed */
var commandHeader = 'const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; ' +
'const Main = imports.ui.main; ' +
- 'const Mainloop = imports.mainloop; ' +
/* Utility functions...we should probably be able to use these
* in the shell core code too. */
'const stage = global.stage; ' +
gcIcon.connect('button-press-event', () => {
gcIcon.icon_name = 'user-trash';
System.gc();
- this._timeoutId = Mainloop.timeout_add(500, () => {
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => {
gcIcon.icon_name = 'user-trash-full';
this._timeoutId = 0;
return GLib.SOURCE_REMOVE;
const { Atspi, Clutter, GDesktopEnums,
Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
_clearScrollContentsTimer() {
if (this._scrollContentsTimerId != 0) {
- Mainloop.source_remove(this._scrollContentsTimerId);
+ GLib.source_remove(this._scrollContentsTimerId);
this._scrollContentsTimerId = 0;
}
}
}
this._clearScrollContentsTimer();
- this._scrollContentsTimerId = Mainloop.timeout_add(POINTER_REST_TIME, () => {
+ this._scrollContentsTimerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, POINTER_REST_TIME, () => {
this._scrollContentsToDelayed(x, y);
return GLib.SOURCE_REMOVE;
});
initializeDeferredWork, getThemeStylesheet, setThemeStylesheet */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const AccessDialog = imports.ui.accessDialog;
const AudioDeviceSelection = imports.ui.audioDeviceSelection;
_deferredWorkQueue.splice(index, 1);
_deferredWorkData[workId].callback();
if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) {
- Mainloop.source_remove(_deferredTimeoutId);
+ GLib.source_remove(_deferredTimeoutId);
_deferredTimeoutId = 0;
}
}
_queueBeforeRedraw(workId);
return;
} else if (_deferredTimeoutId == 0) {
- _deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => {
+ _deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork();
_deferredTimeoutId = 0;
return GLib.SOURCE_REMOVE;
SystemNotificationSource, MessageTray */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Calendar = imports.ui.calendar;
_resetNotificationLeftTimeout() {
this._useLongerNotificationLeftTimeout = false;
if (this._notificationLeftTimeoutId) {
- Mainloop.source_remove(this._notificationLeftTimeoutId);
+ GLib.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -1;
// We wait for a longer period if the notification popped up where the mouse pointer was already positioned.
// That gives the user more time to mouse away from the notification and mouse back in in order to expand it.
let timeout = this._useLongerNotificationLeftTimeout ? LONGER_HIDE_TIMEOUT : HIDE_TIMEOUT;
- this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, this._onNotificationLeftTimeout.bind(this));
+ this._notificationLeftTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout, this._onNotificationLeftTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
}
}
x < this._notificationLeftMouseX + MOUSE_LEFT_ACTOR_THRESHOLD &&
x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) {
this._notificationLeftMouseX = -1;
- this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT,
- this._onNotificationLeftTimeout.bind(this));
+ this._notificationLeftTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ LONGER_HIDE_TIMEOUT,
+ this._onNotificationLeftTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
} else {
this._notificationLeftTimeoutId = 0;
_updateNotificationTimeout(timeout) {
if (this._notificationTimeoutId) {
- Mainloop.source_remove(this._notificationTimeoutId);
+ GLib.source_remove(this._notificationTimeoutId);
this._notificationTimeoutId = 0;
}
if (timeout > 0) {
this._notificationTimeoutId =
- Mainloop.timeout_add(timeout,
- this._notificationTimeout.bind(this));
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
+ this._notificationTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] this._notificationTimeout');
}
}
/* exported NotificationDaemon */
const { GdkPixbuf, Gio, GLib, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Config = imports.misc.config;
const Main = imports.ui.main;
// Ignore replacesId since we already sent back a
// NotificationClosed for that id.
id = this._nextNotificationId++;
- let idleId = Mainloop.idle_add(() => {
+ let idleId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
return GLib.SOURCE_REMOVE;
});
/* exported OsdWindowManager */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
-const Mainloop = imports.mainloop;
const BarLevel = imports.ui.barLevel;
const Layout = imports.ui.layout;
}
if (this._hideTimeoutId)
- Mainloop.source_remove(this._hideTimeoutId);
- this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT,
- this._hide.bind(this));
+ GLib.source_remove(this._hideTimeoutId);
+ this._hideTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT, HIDE_TIMEOUT, this._hide.bind(this));
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
}
if (!this._hideTimeoutId)
return;
- Mainloop.source_remove(this._hideTimeoutId);
+ GLib.source_remove(this._hideTimeoutId);
this._hide();
}
/* exported Overview */
const { Clutter, GLib, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
_resetWindowSwitchTimeout() {
if (this._windowSwitchTimeoutId != 0) {
- Mainloop.source_remove(this._windowSwitchTimeoutId);
+ GLib.source_remove(this._windowSwitchTimeoutId);
this._windowSwitchTimeoutId = 0;
}
}
if (targetIsWindow) {
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
- this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
+ this._windowSwitchTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ DND_WINDOW_SWITCH_TIMEOUT,
() => {
this._windowSwitchTimeoutId = 0;
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Cairo = imports.cairo;
-const Mainloop = imports.mainloop;
const Animation = imports.ui.animation;
const Config = imports.misc.config;
return DND.DragMotionResult.CONTINUE;
if (this._xdndTimeOut != 0)
- Mainloop.source_remove(this._xdndTimeOut);
- this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT, () => {
+ GLib.source_remove(this._xdndTimeOut);
+ this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
this._xdndToggleOverview();
});
GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview');
if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle();
- Mainloop.source_remove(this._xdndTimeOut);
+ GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = 0;
return GLib.SOURCE_REMOVE;
}
/* exported getPointerWatcher */
const { GLib, Meta } = imports.gi;
-const Mainloop = imports.mainloop;
// We stop polling if the user is idle for more than this amount of time
var IDLE_TIME = 1000;
_updateTimeout() {
if (this._timeoutId) {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
for (let i = 1; i < this._watches.length; i++)
minInterval = Math.min(this._watches[i].interval, minInterval);
- this._timeoutId = Mainloop.timeout_add(minInterval,
- this._onTimeout.bind(this));
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, minInterval,
+ this._onTimeout.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
}
const { AccountsService, Clutter, Cogl, Gio, GLib,
GnomeDesktop, GObject, Meta, Shell, St } = imports.gi;
const Cairo = imports.cairo;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
let lockTimeout = Math.max(
STANDARD_FADE_TIME,
this._settings.get_uint(LOCK_DELAY_KEY) * 1000);
- this._lockTimeoutId = Mainloop.timeout_add(lockTimeout,
- () => {
- this._lockTimeoutId = 0;
- this.lock(false);
- return GLib.SOURCE_REMOVE;
- });
+ this._lockTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ lockTimeout,
+ () => {
+ this._lockTimeoutId = 0;
+ this.lock(false);
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
}
this._arrowActiveWatchId = 0;
if (!this._arrowAnimationId) {
- this._arrowAnimationId = Mainloop.timeout_add(6000, this._animateArrows.bind(this));
+ this._arrowAnimationId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 6000, this._animateArrows.bind(this));
GLib.Source.set_name_by_id(this._arrowAnimationId, '[gnome-shell] this._animateArrows');
this._animateArrows();
}
_pauseArrowAnimation() {
if (this._arrowAnimationId) {
- Mainloop.source_remove(this._arrowAnimationId);
+ GLib.source_remove(this._arrowAnimationId);
this._arrowAnimationId = 0;
}
_stopArrowAnimation() {
if (this._arrowAnimationId) {
- Mainloop.source_remove(this._arrowAnimationId);
+ GLib.source_remove(this._arrowAnimationId);
this._arrowAnimationId = 0;
}
if (this._arrowActiveWatchId) {
if (params.fadeToBlack && params.animateFade) {
// Take a beat
- let id = Mainloop.timeout_add(MANUAL_FADE_TIME, () => {
+ let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MANUAL_FADE_TIME, () => {
this._activateFade(this._shortLightbox, MANUAL_FADE_TIME);
return GLib.SOURCE_REMOVE;
});
}
if (this._lockTimeoutId != 0) {
- Mainloop.source_remove(this._lockTimeoutId);
+ GLib.source_remove(this._lockTimeoutId);
this._lockTimeoutId = 0;
}
collectStatistics, runPerfScript */
const { Gio, GLib, Meta, Shell } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
const Params = imports.misc.params;
*/
function sleep(milliseconds) {
return new Promise(resolve => {
- let id = Mainloop.timeout_add(milliseconds, () => {
+ let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, milliseconds, () => {
resolve();
return GLib.SOURCE_REMOVE;
});
/* exported SessionMode, listModes */
const GLib = imports.gi.GLib;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const FileUtils = imports.misc.fileUtils;
function listModes() {
_loadModes();
- let id = Mainloop.idle_add(() => {
+ let loop = new GLib.MainLoop(null, false);
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
let names = Object.getOwnPropertyNames(_modes);
for (let i = 0; i < names.length; i++)
if (_modes[names[i]].isPrimary)
print(names[i]);
- Mainloop.quit('listModes');
+ loop.quit();
});
GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
- Mainloop.run('listModes');
+ loop.run();
}
var SessionMode = class {
/* exported ATIndicator */
const { Gio, GLib, GObject, St } = imports.gi;
-const Mainloop = imports.mainloop;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
if (this._syncMenuVisibilityIdle)
return;
- this._syncMenuVisibilityIdle = Mainloop.idle_add(this._syncMenuVisibility.bind(this));
+ this._syncMenuVisibilityIdle = GLib.idle_add(GLib.PRIORITY_DEFAULT, this._syncMenuVisibility.bind(this));
GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility');
}
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported NMApplet */
const { Clutter, Gio, GLib, GObject, NM, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Animation = imports.ui.animation;
this._updateSensitivity();
this._syncView();
- this._scanTimeoutId = Mainloop.timeout_add_seconds(15, this._onScanTimeout.bind(this));
+ this._scanTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 15, this._onScanTimeout.bind(this));
GLib.Source.set_name_by_id(this._scanTimeoutId, '[gnome-shell] this._onScanTimeout');
this._onScanTimeout();
}
if (this._scanTimeoutId) {
- Mainloop.source_remove(this._scanTimeoutId);
+ GLib.source_remove(this._scanTimeoutId);
this._scanTimeoutId = 0;
}
}
/* exported SwitcherPopup, SwitcherList */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
// We delay showing the popup so that fast Alt+Tab users aren't
// disturbed by the popup briefly flashing.
- this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
- () => {
- Main.osdWindowManager.hideAll();
- this.opacity = 255;
- this._initialDelayTimeoutId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ this._initialDelayTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ POPUP_DELAY_TIMEOUT,
+ () => {
+ Main.osdWindowManager.hideAll();
+ this.opacity = 255;
+ this._initialDelayTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
return true;
}
this.mouseActive = false;
if (this._motionTimeoutId != 0)
- Mainloop.source_remove(this._motionTimeoutId);
+ GLib.source_remove(this._motionTimeoutId);
- this._motionTimeoutId = Mainloop.timeout_add(DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this));
+ this._motionTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this));
GLib.Source.set_name_by_id(this._motionTimeoutId, '[gnome-shell] this._mouseTimedOut');
}
_resetNoModsTimeout() {
if (this._noModsTimeoutId != 0)
- Mainloop.source_remove(this._noModsTimeoutId);
+ GLib.source_remove(this._noModsTimeoutId);
- this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT,
- () => {
- this._finish(global.get_current_time());
- this._noModsTimeoutId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ this._noModsTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ NO_MODS_TIMEOUT,
+ () => {
+ this._finish(global.get_current_time());
+ this._noModsTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
}
_popModal() {
this._popModal();
if (this._motionTimeoutId != 0)
- Mainloop.source_remove(this._motionTimeoutId);
+ GLib.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0)
- Mainloop.source_remove(this._initialDelayTimeoutId);
+ GLib.source_remove(this._initialDelayTimeoutId);
if (this._noModsTimeoutId != 0)
- Mainloop.source_remove(this._noModsTimeoutId);
+ GLib.source_remove(this._noModsTimeoutId);
}
_select(num) {
/* exported WindowManager */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const AltTab = imports.ui.altTab;
action: this._onSuccess.bind(this),
default: true });
- this._timeoutId = Mainloop.timeout_add(ONE_SECOND, this._tick.bind(this));
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, ONE_SECOND, this._tick.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick');
}
close(timestamp) {
if (this._timeoutId > 0) {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
keepWorkspaceAlive(workspace, duration) {
if (workspace._keepAliveId)
- Mainloop.source_remove(workspace._keepAliveId);
+ GLib.source_remove(workspace._keepAliveId);
- workspace._keepAliveId = Mainloop.timeout_add(duration, () => {
+ workspace._keepAliveId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, duration, () => {
workspace._keepAliveId = 0;
this._queueCheckWorkspaces();
return GLib.SOURCE_REMOVE;
_windowRemoved(workspace, window) {
workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces();
- let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, () => {
+ let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, LAST_WINDOW_GRACE_TIME, () => {
if (workspace._lastRemovedWindow == window) {
workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces();
/* exported Workspace */
const { Atk, Clutter, GLib, GObject, Meta, Pango, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const DND = imports.ui.dnd;
_onDestroy() {
if (this._idleHideOverlayId > 0) {
- Mainloop.source_remove(this._idleHideOverlayId);
+ GLib.source_remove(this._idleHideOverlayId);
this._idleHideOverlayId = 0;
}
this._windowClone.metaWindow.disconnect(this._updateCaptionId);
_onHideChrome() {
if (this._idleHideOverlayId == 0) {
- this._idleHideOverlayId = Mainloop.timeout_add(WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT, this._idleHideOverlay.bind(this));
+ this._idleHideOverlayId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT, this._idleHideOverlay.bind(this));
GLib.Source.set_name_by_id(this._idleHideOverlayId, '[gnome-shell] this._idleHideOverlay');
}
}
hideOverlay() {
if (this._idleHideOverlayId > 0) {
- Mainloop.source_remove(this._idleHideOverlayId);
+ GLib.source_remove(this._idleHideOverlayId);
this._idleHideOverlayId = 0;
}
this.closeButton.hide();
_realRecalculateWindowPositions(flags) {
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
// remove old handler
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
this._cursorY = y;
this._currentLayout = null;
- this._repositionWindowsId = Mainloop.timeout_add(WINDOW_REPOSITIONING_DELAY,
+ this._repositionWindowsId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, WINDOW_REPOSITIONING_DELAY,
this._delayedWindowRepositioning.bind(this));
GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell] this._delayedWindowRepositioning');
}
if (!win) {
// Newly-created windows are added to a workspace before
// the compositor finds out about them...
- let id = Mainloop.idle_add(() => {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (this.actor &&
metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace)
this._windows[i].remove_all_transitions();
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
this._windows[i].remove_all_transitions();
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this));
global.display.disconnect(this._windowLeftMonitorId);
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
/* exported WorkspaceSwitcherPopup */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
this._redisplay();
if (this._timeoutId != 0)
- Mainloop.source_remove(this._timeoutId);
- this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, this._onTimeout.bind(this));
+ GLib.source_remove(this._timeoutId);
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISPLAY_TIMEOUT, this._onTimeout.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
this._show();
}
_onTimeout() {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
this._container.ease({
opacity: 0.0,
_onDestroy() {
if (this._timeoutId)
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
let workspaceManager = global.workspace_manager;
/* exported WorkspaceThumbnail, ThumbnailsBox */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
if (!win) {
// Newly-created windows are added to a workspace before
// the compositor finds out about them...
- let id = Mainloop.idle_add(() => {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (!this._removed &&
metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace)
const UI = imports.testcommon.ui;
const { Clutter, GLib, St } = imports.gi;
-const Mainloop = imports.mainloop;
const DELAY = 2000;
resize_animated(label1);
resize_animated(label2);
- Mainloop.timeout_add(DELAY, () => {
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, DELAY, () => {
log(label1 + label1.get_size());
resize_animated(label1);
resize_animated(label2);
return true;
});
- Mainloop.timeout_add(2 * DELAY, () => {
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2 * DELAY, () => {
iter += 1;
iter %= shadowStyles.length;
label1.set_style(get_css_style(shadowStyles[iter]));
const UI = imports.testcommon.ui;
-const { Clutter, St } = imports.gi;
-const Mainloop = imports.mainloop;
+const { Clutter, GLib, St } = imports.gi;
function test() {
let stage = new Clutter.Stage({ width: 400, height: 400 });
let entryHintBoth = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
hint_actor: hintActor2 });
let idx = 0;
- Mainloop.timeout_add_seconds(1, function() {
+ GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, function() {
idx++;
if (idx % 2 == 0)
imports.gi.versions.Gtk = '3.0';
-const Gtk = imports.gi.Gtk;
-const Mainloop = imports.mainloop;
+const { GLib, Gtk } = imports.gi;
function nextTitle() {
let length = Math.random() * 20;
});
win.present();
- Mainloop.timeout_add(5000, function() {
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, 5000, function() {
win.title = nextTitle();
return true;
});